<template>
    <div>
        <table>
            <tr>
                <td>图片上传</td>
                <input type="file" @change="save">
            </tr>
        </table>
    </div>
</template>

<script>
export default {
    data () {
        return {
            
        }
    },
    methods: {
        save(e){
            //获取文件
            let file = e.target.files[0]
            //声明请求头
            let confing = {headers:{'Content-Type':'multipart/form-data'}}
            //声明表单参数
            let data = new FormData()
            data.append('file',file,file.name)
            this.axios.post('http://127.0.0.1:8000/uploadp/',data,confing)
            .then(res=>{
                console.log(res)
            })
            

        }
    },

}
</script>

<style>

</style>
